import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [

    {
      path:'/home',
      component:()=>import('views/home/Home.vue')
    },
    {
      path:'/my',
      component:()=>import('views/my/My.vue')
    },
    {
      path:'/cart',
      component:()=>import('views/cart/Cart.vue')
    },
    {
      path:'/category',
      component:()=>import('views/category/Category.vue')
    },
  
]

const router = new VueRouter({
  routes,
  mode: 'history',
  base: process.env.BASE_URL,
  
})
//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
export default router
